;; Compile Options : /TM610409 /MS /near /Imain /Iclk /IINTERR~1 /Ikey /Ilcd /Ilcdshow /Imelody /Ircadc /Itemphum /Itimers /IMACROA~1 /Ieternity /ICLKbuzz /SD /Om /W 1 /Fa_output\_obj\ 
;; Version Number  : Ver.3.54.3
;; File Name       : clk.c

	type (M610409) 
	model small, near
	$$NINITVAR segment data 2h #0h
	$$NINITTAB segment table 2h any
	$$HIGH2_career$clk segment code 2h #0h
	$$HIGH_career$clk segment code 2h #0h
	$$LOW_career$clk segment code 2h #0h
	$$WD_Feed$clk segment code 2h #0h
	$$clk_fcon0_init$clk segment code 2h #0h
	$$clk_fcon1_init$clk segment code 2h #0h
CVERSION 3.54.3
CGLOBAL 01H 03H 0000H "LOW_career" 08H 02H 04H 00H 81H 04H 00H 00H 01H
CGLOBAL 01H 03H 0000H "WD_Feed" 08H 02H 02H 00H 80H 00H 00H 00H 07H
CGLOBAL 01H 03H 0000H "clk_fcon0_init" 08H 02H 00H 00H 83H 04H 00H 00H 01H
CGLOBAL 01H 03H 0000H "HIGH2_career" 08H 02H 05H 00H 81H 04H 00H 00H 01H
CGLOBAL 01H 03H 0000H "HIGH_career" 08H 02H 03H 00H 81H 04H 00H 00H 01H
CGLOBAL 01H 03H 0000H "clk_fcon1_init" 08H 02H 01H 00H 83H 04H 00H 00H 01H
CSTRUCTTAG 0000H 0000H 0000H 0008H 00000001H "_Notag"
CSTRUCTMEM 52H 00000001H 00000000H "b0" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000001H "b1" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000002H "b2" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000003H "b3" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000004H "b4" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000005H "b5" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000006H "b6" 02H 00H 00H
CSTRUCTMEM 52H 00000001H 00000007H "b7" 02H 00H 00H
CENUMTAG 0000H 0000H 0001H 0004H "CLKmode_value"
CENUMMEM 00000000H "CLK_one"
CENUMMEM 00000001H "CLK_two"
CENUMMEM 00000002H "CLK_three"
CENUMMEM 00000003H "CLK_four"
CTYPEDEF 0000H 0000H 42H "uint8" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "DWORD" 02H 00H 02H
CTYPEDEF 0000H 0000H 43H "INT8" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "uint32" 02H 00H 02H
CTYPEDEF 0000H 0000H 42H "uint16" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "byte" 02H 00H 00H
CTYPEDEF 0000H 0000H 43H "INT32" 02H 00H 02H
CTYPEDEF 0000H 0000H 43H "INT16" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "dword" 02H 00H 02H
CTYPEDEF 0000H 0000H 43H "int8" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "UINT" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "WORD" 02H 00H 01H
CTYPEDEF 0000H 0000H 43H "int16" 02H 00H 01H
CTYPEDEF 0000H 0000H 43H "int32" 02H 00H 02H
CTYPEDEF 0000H 0000H 42H "UINT8" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "uint" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "uchar" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "UINT16" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "UINT32" 02H 00H 02H
CTYPEDEF 0000H 0000H 42H "word" 02H 00H 01H
CTYPEDEF 0000H 0000H 42H "BOOL" 02H 00H 00H
CTYPEDEF 0000H 0000H 42H "BYTE" 02H 00H 00H
CTYPEDEF 0000H 0000H 43H "_BYTE_FIELD" 04H 00H 05H 00H 00H
CGLOBAL 01H 42H 0004H "SYSC_MODE_CLK" 05H 01H 04H 00H 00H 00H
CGLOBAL 01H 42H 0004H "OUTC_MODE_CLK" 05H 01H 04H 00H 00H 00H
CFILE 0001H 00000822H "E:\\IDEU8\\Inc\\m610409.h"
CFILE 0002H 00000033H "clk\\clk.h"
CFILE 0003H 00000025H "MACROA~1\\MacroAndConst.h"
CFILE 0000H 0000007FH "clk\\clk.c"

	rseg $$clk_fcon0_init$clk
CFUNCTION 0

_clk_fcon0_init	:
CBLOCK 0 1 43

;; {
CLINEA 0000H 0001H 002BH 0002H 0002H
	push	lr
	bl	__regpushu8sw
	mov	er8,	er0
CBLOCK 0 2 43
CRET 000CH
CARGUMENT 46H 0002H 0034H "sysc" 02H 00H 01H
CARGUMENT 46H 0002H 0031H "outc" 02H 00H 01H
CARGUMENT 42H 0002H 000EH "oscm" 02H 00H 01H
CLOCAL 4AH 0001H 0000H 0002H "r0" 02H 00H 00H
CLOCAL 4AH 0001H 0000H 0002H "r1" 02H 00H 00H

;;   if(sysc >= SYSC_MODE || outc >= OUT_MODE || oscm > OSCM_2MHZ) {
CLINEA 0000H 0001H 002DH 0004H 0042H
	cmp	r0,	#04h
	cmpc	r1,	#00h
	bge	_$L2
	cmp	r2,	#04h
	cmpc	r3,	#00h
	bge	_$L2
	l	er0,	14[fp]
	cmp	r0,	#01h
	cmpc	r1,	#00h
	ble	_$L1
_$L2 :
CBLOCK 0 3 45

;;    return (CLK_DEPLOY_FAIL);
CLINEA 0000H 0001H 002EH 0005H 001DH
	mov	er0,	#-1
CBLOCKEND 0 3 47
CBLOCKEND 0 2 55

;;  }
CLINEA 0000H 0001H 0037H 0003H 0003H
_$L0 :
	b	__regpopu8sw

;;    }
CLINEA 0000H 0000H 002FH 0005H 0005H
_$L1 :

;;                           (r1 << 4) );
CLINEA 0000H 0001H 0034H 001CH 0027H
	l	r0,	NEAR _OUTC_MODE_CLK[er2]
	sll	r0,	#04h
	l	r1,	NEAR _SYSC_MODE_CLK[er8]
	or	r0,	r1
	st	r0,	0f002h

;;    OSCM2 = oscm;
CLINEA 0000H 0001H 0035H 0005H 0011H
	l	r0,	14[fp]
	and	r0,	#01h
	beq	_$M1
	sb	0f002h.6
	bal	_$M2
_$M1 :
	rb	0f002h.6
_$M2 :

;;   return (CLK_DEPLOY_OK);
CLINEA 0000H 0001H 0036H 0004H 001AH
	mov	er0,	#0 
	bal	_$L0
CBLOCKEND 0 1 55
CFUNCTIONEND 0


	rseg $$clk_fcon1_init$clk
CFUNCTION 1

_clk_fcon1_init	:
CBLOCK 1 1 72

;; {
CLINEA 0000H 0001H 0048H 0002H 0002H
	push	lr
	bl	__regpushu8sw
	mov	er8,	er0
CBLOCK 1 2 72
CRET 000CH
CARGUMENT 46H 0002H 0034H "syscl" 02H 00H 01H
CARGUMENT 46H 0002H 0031H "enos" 02H 00H 01H
CARGUMENT 42H 0002H 000EH "enml" 02H 00H 01H
CLOCAL 4AH 0002H 0000H 0002H "r0" 02H 00H 01H
CLOCAL 4AH 0002H 0000H 0002H "r1" 02H 00H 01H
CLOCAL 4AH 0002H 0000H 0002H "r2" 02H 00H 01H

;;	   enml > ENM_ENABLES_LOWCLK) {
CLINEA 0000H 0001H 004BH 0005H 0020H
	cmp	r0,	#01h
	cmpc	r1,	#00h
	bgt	_$L13
	cmp	r2,	#01h
	cmpc	r3,	#00h
	bgt	_$L13
	l	er0,	14[fp]
	cmp	r0,	#01h
	cmpc	r1,	#00h
	ble	_$L12
_$L13 :
CBLOCK 1 3 75

;;   	 return (CLK_DEPLOY_FAIL);	
CLINEA 0000H 0001H 004CH 0006H 001FH
	mov	er0,	#-1
CBLOCKEND 1 3 77
CBLOCKEND 1 2 84

;;  }
CLINEA 0000H 0001H 0054H 0003H 0003H
_$L11 :
	b	__regpopu8sw

;;   	 }	
CLINEA 0000H 0000H 004DH 0006H 0007H
_$L12 :

;;                                       (r2 << 2) );
CLINEA 0000H 0001H 0052H 0028H 0033H
	mov	er0,	er2
	sll	r0,	#01h
	mov	r2,	r0
	or	r2,	r8
	l	er0,	14[fp]
	sll	r0,	#02h
	or	r0,	r2
	st	r0,	0f003h

;;   return (CLK_DEPLOY_OK);
CLINEA 0000H 0001H 0053H 0004H 001AH
	mov	er0,	#0 
	bal	_$L11
CBLOCKEND 1 1 84
CFUNCTIONEND 1


	rseg $$WD_Feed$clk
CFUNCTION 2

_WD_Feed	:
CBLOCK 2 1 93

;; {
CLINEA 0000H 0001H 005DH 0002H 0002H
CBLOCK 2 2 93

;;  do
CLINEA 0000H 0001H 005EH 0003H 0004H
_$L25 :
CBLOCK 2 3 95

;;    WDTCON = 0x5a;
CLINEA 0000H 0001H 0060H 0005H 0012H
	mov	r0,	#05ah
	st	r0,	0f00eh
CBLOCKEND 2 3 97

;;     }while(WDP != 1);
CLINEA 0000H 0000H 0061H 0006H 0016H
	tb	0f00eh.0
	beq	_$L25

;;    WDTCON = 0xa5;
CLINEA 0000H 0001H 0062H 0005H 0012H
	mov	r0,	#0a5h
	st	r0,	0f00eh
CBLOCKEND 2 2 99

;;   }
CLINEA 0000H 0001H 0063H 0004H 0004H
	rt
CBLOCKEND 2 1 99
CFUNCTIONEND 2


	rseg $$HIGH_career$clk
CFUNCTION 3

_HIGH_career	:
CBLOCK 3 1 108

;; {
CLINEA 0000H 0001H 006CH 0002H 0002H
	push	lr
CBLOCK 3 2 108
CRET 0000H

;;   if(clk_fcon0_init(CLK_four, CLK_four, OSCM_2MHZ) == CLK_DEPLOY_OK)
CLINEA 0000H 0001H 006DH 0004H 0045H
	mov	er0,	#1 
	push	er0
	mov	er2,	#3 
	mov	er0,	#3 
	bl	_clk_fcon0_init
	add	sp,	#2 
	mov	er0,	er0
	bne	_$L28

;;     return clk_fcon1_init(SYSCLK_HSCLK, ENO_ENABLES_HIGHCLK, ENM_ENABLES_LOWCLK);
CLINEA 0000H 0001H 006EH 0006H 0052H
	mov	er0,	#1 
	push	er0
	mov	er2,	#1 
	bl	_clk_fcon1_init
	add	sp,	#2 
CBLOCKEND 3 2 112

;;  }
CLINEA 0000H 0001H 0070H 0003H 0003H
_$L27 :
	pop	pc

;;     return clk_fcon1_init(SYSCLK_HSCLK, ENO_ENABLES_HIGHCLK, ENM_ENABLES_LOWCLK);
CLINEA 0000H 0000H 006EH 0006H 0052H
_$L28 :

;;     return (CLK_DEPLOY_FAIL);
CLINEA 0000H 0001H 006FH 0006H 001EH
	mov	er0,	#-1
	bal	_$L27
CBLOCKEND 3 1 112
CFUNCTIONEND 3


	rseg $$HIGH2_career$clk
CFUNCTION 5

_HIGH2_career	:
CBLOCK 5 1 115

;; {
CLINEA 0000H 0001H 0073H 0002H 0002H
	push	lr
CBLOCK 5 2 115
CRET 0000H

;;   if(clk_fcon0_init(CLK_one, CLK_one, OSCM_2MHZ) == CLK_DEPLOY_OK)
CLINEA 0000H 0001H 0074H 0004H 0043H
	mov	er0,	#1 
	push	er0
	mov	er2,	#0 
	mov	er0,	#0 
	bl	_clk_fcon0_init
	add	sp,	#2 
	mov	er0,	er0
	bne	_$L31

;;     return clk_fcon1_init(SYSCLK_HSCLK, ENO_ENABLES_HIGHCLK, ENM_ENABLES_LOWCLK);
CLINEA 0000H 0001H 0075H 0006H 0052H
	mov	er0,	#1 
	push	er0
	mov	er2,	#1 
	bl	_clk_fcon1_init
	add	sp,	#2 
CBLOCKEND 5 2 119

;;  }
CLINEA 0000H 0001H 0077H 0003H 0003H
_$L30 :
	pop	pc

;;     return clk_fcon1_init(SYSCLK_HSCLK, ENO_ENABLES_HIGHCLK, ENM_ENABLES_LOWCLK);
CLINEA 0000H 0000H 0075H 0006H 0052H
_$L31 :

;;     return (CLK_DEPLOY_FAIL);
CLINEA 0000H 0001H 0076H 0006H 001EH
	mov	er0,	#-1
	bal	_$L30
CBLOCKEND 5 1 119
CFUNCTIONEND 5


	rseg $$LOW_career$clk
CFUNCTION 4

_LOW_career	:
CBLOCK 4 1 123

;; {
CLINEA 0000H 0001H 007BH 0002H 0002H
	push	lr
CBLOCK 4 2 123
CRET 0000H

;;   if(clk_fcon0_init(CLK_four, CLK_four, OSCM_2MHZ) == CLK_DEPLOY_OK)
CLINEA 0000H 0001H 007CH 0004H 0045H
	mov	er0,	#1 
	push	er0
	mov	er2,	#3 
	mov	er0,	#3 
	bl	_clk_fcon0_init
	add	sp,	#2 
	mov	er0,	er0
	bne	_$L34

;;     return clk_fcon1_init(SYSCLK_LSCLK, ENO_STOP_HIGHCLK, ENM_DISABLES_LOWCLK);
CLINEA 0000H 0001H 007DH 0006H 0050H
	mov	er0,	#0 
	push	er0
	mov	er2,	#0 
	bl	_clk_fcon1_init
	add	sp,	#2 
CBLOCKEND 4 2 127

;;  }
CLINEA 0000H 0001H 007FH 0003H 0003H
_$L33 :
	pop	pc

;;     return clk_fcon1_init(SYSCLK_LSCLK, ENO_STOP_HIGHCLK, ENM_DISABLES_LOWCLK);
CLINEA 0000H 0000H 007DH 0006H 0050H
_$L34 :

;;     return (CLK_DEPLOY_FAIL);
CLINEA 0000H 0001H 007EH 0006H 001EH
	mov	er0,	#-1
	bal	_$L33
CBLOCKEND 4 1 127
CFUNCTIONEND 4

	public _LOW_career
	public _WD_Feed
	public _SYSC_MODE_CLK
	public _clk_fcon0_init
	public _HIGH2_career
	public _HIGH_career
	public _OUTC_MODE_CLK
	public _clk_fcon1_init
	extrn code near : _main

	rseg $$NINITTAB
	db	00h
	db	01h
	db	02h
	db	03h
	db	00h
	db	01h
	db	02h
	db	03h

	rseg $$NINITVAR
_SYSC_MODE_CLK :
	ds	04h
_OUTC_MODE_CLK :
	ds	04h
	extrn code : __regpushu8sw
	extrn code : __regpopu8sw

	end
